import { treeType } from './../../types/project';
import { reactive } from 'vue';

export const treeBus = reactive({
    // 传递选中的id
    id: "",
    /* 传递选中的元素 */
    selectItem: {} as any,
    /* 预览单个属性 */
    props: {} as treeType,
    /* 预览多个属性 */
    propList: [] as Array<treeType>,
    /* 展示模式，当是props时 */
    mode: ""/* props|propList  */,
    target: {} as treeType
})

/* 设置单项 */
export const setProp = function (item: treeType) {
    treeBus.mode = "props"
    treeBus.props = item
}

/* 设置多项 */
export const setPropList = function (item: Array<treeType>) {
    treeBus.mode = "propList"
    treeBus.propList = item
}
